package com.nuoyun.tnvmue.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.nuoyun.tnvmue.R
import com.nuoyun.tnvmue.adapter.NewsAdapter
import com.nuoyun.tnvmue.model.NewsModel
import kotlinx.android.synthetic.main.activity_news.*

/**
 * @author jiangyao
 * Date: 2020/4/10
 * Email: jiangmr@vip.qq.com
 * TODO: 最新消息
 */
class NewsActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_news)
        setBack(true)
        setTitle("最新信息")

        val adapter = NewsAdapter(this)

        val models = ArrayList<NewsModel>()

        val model1 = NewsModel()
        model1.title = "深切哀悼"
        model1.name = "影迷管理 2020-04-04 00:00"
        model1.message = "深切哀悼 在抗击新冠肺炎疫情斗争中牺牲的烈士和去世同胞"
        models.add(model1)

        val model2 = NewsModel()
        model2.title = "关于安卓手机不能横屏"
        model2.name = "影迷管理 2020-04-04 00:00"
        model2.message = "关于安卓手机不能横屏，软件左下角 我的，设置，X5内核修复，安装线上内核，即可解决。苹果闪退用户卸载重装即可"
        models.add(model2)

        val model3 = NewsModel()
        model3.name = "影迷管理 2020-04-04 00:00"
        models.add(model3)

        val model4 = NewsModel()
        model4.name = "影迷管理 2020-04-04 00:00"
        models.add(model4)

        adapter.setModels(models)
        news_list.adapter = adapter
    }

    companion object {
        fun start(context: Context) {
            val intent = Intent()
            intent.setClass(context, NewsActivity::class.java)
            context.startActivity(intent)
        }
    }
}